////////////////////////////////////////////////////////////////////////////////
//                                                                            //
//  Filename:    MermaidQueenGuts.h                                           //
//  Developer:   Tommy Riddle                                                 //
//  Create date: 02/13/2006                                                   //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////
//                                                                            //
//  Description: This is the class declaration for the slot gut of the        //
//               Australian Slot machine called Mermaid Queen.                //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////
//        Copyright (c) 2006 - Realtime Gaming.  All rights reserved.         //
////////////////////////////////////////////////////////////////////////////////

#if !defined(__MERMAIDQUEENGUTS_H__)
#define __MERMAIDQUEENGUTS_H__

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000


#include "slotguts.h"

class MermaidQueenGuts : public SlotGuts
{
public:
	MermaidQueenGuts();

	virtual ~MermaidQueenGuts();

private:
	// Shared enums between client and server
	#include "MermaidQueenCommon.h"

	// Helpful lookup arrays.
	static SpinResult m_aLineWinSpinResults[][6];

	static SpinResult m_aScatterWinSpinResults[6];

	// Inline functions to use with the arrays that also do
	// bounds checking.
	static SpinResult lookupLineWinSpinResult( uint8 nIconType, uint8 nCount )
	{
		if ( nIconType < NUM_VALID_ICONS && nCount < 6 )
		{
			return m_aLineWinSpinResults[ nIconType ][ nCount ];
		}

		ASSERT( false );
		return EVT_INVALID;
	}

	static SpinResult lookupScatterWinSpinResult( uint8 nCount )
	{
		if ( nCount < 6 )
		{
			return m_aScatterWinSpinResults[ nCount ];
		}

		ASSERT( false );
		return EVT_INVALID;
	}

	int32 getFreeSpinMultiplier() const
	{
		int32 nCount = m_subGame->getData( SGDIDX_NUM_FREE_SPINS_PLAYED );

		if ( nCount > 10 )
		{
			return MULTIPLIER_AFTER_10_FREE_SPINS;
		}

		return MULTIPLIER_FIRST_10_FREE_SPINS;
	}

	int32 getFreeSpinNote() const
	{
		int32 nCount = m_subGame->getData( SGDIDX_NUM_FREE_SPINS_PLAYED );

		if ( nCount > 10 )
		{
			return NOTE_AFTER_10_FREE_SPINS;
		}

		return NOTE_FIRST_10_FREE_SPINS;
	}

	// Helper functions for classifyStops.
	SpinResult getMermaidLineWinResult( uint8* stops ) const;

	SpinResult getLineWinResultWithPossibleSubstitution( uint8* stops, uint8 testIcon, bool& bSubstitution ) const;

	bool doesMermaidLineWinPayMore( SpinResult srMermaid, SpinResult srOther ) const;

	// Helper functions for classifyScatters.
	void tryForJackpot( SlotSpin* spin );

	uint8 getNumScatterIcons( SlotSpin* spin, uint8 nIconType, int32& scatterPositions ) const;

	SpinResult getScatterWinResult( SlotSpin* spin, int32& scatterPositions );
	
	void evaluateScatterWin( SlotSpin* spin, SpinResult srScatterResult, int32 scatterPositions );

	SpinResult getFeatureTriggerResult( SlotSpin* spin, int32& scatterPositions ) const;

	void evaluateFeatureTrigger( SlotSpin* spin, SpinResult srScatterResult, int32 scatterPositions );

public:
	virtual void classifyStops( SpinLine* spinline, uint8* stops, uint8 bet, uint8 line,
		uint8& rtnresult, uint8& multiplier );

	virtual void classifyScatters( SlotSpin *spin );

    virtual bool8 isValidGuts();

    virtual void getGameModeMultiplierAndNoteId( uint8& nGameModeMultiplier, uint8& nNoteId );

protected:

	// Override of the framework function.
	virtual void preSpinClassifyResults( SlotSpin *spin );
};

#endif // !defined(__MERMAIDQUEENGUTS_H__)
